package tests;

import org.testng.annotations.Test;
import org.testng.annotations.AfterMethod;
import static org.junit.Assert.*;

import model.Film;


public class SearchMovieNew extends tests.supers.TestBase{

	@AfterMethod
	public void checkLogin(){

		if(app.getUserHelper().isLoggedIn())
			app.getUserHelper().logout();
	}

	@Test
	public void searchMovieOK(){

		app.getUserHelper().loginAs(ADMIN);

		String movieExisting = app.getFilmHelper().ensureHasMovie();
		assertTrue(app.getFilmHelper().search(movieExisting));

	}

	@Test
	public void searchMovieFailure(){

		Film movieUnexisting = Film.generateNewFilm();

		app.getUserHelper().loginAs(ADMIN);

		assertTrue(!app.getFilmHelper().search(movieUnexisting.getImdb()));

	}

}
